<div ng-if="envVars.length" class="table-responsive" style="margin-top: 5px;">
  <table class="table table-bordered environment-variables">
    <thead>
      <tr>
        <th>Name</th>
        <th>Value</th>
      </tr>
    </thead>
    <tbody>
      <tr ng-repeat="env in envVars">
        <td>{{env.name}}</td>
        <td ng-if="!env.valueFrom">
            <truncate-long-text class="env-var-value" content="env.value" limit="200" newline-limit="3" expandable="true" prettify-json="true"></truncate-long-text>
        </td>
        <td ng-if="env.valueFrom">
          <span class="fa fa-external-link-square" style="cursor: help;" data-toggle="popover" data-trigger="hover" data-content="This is a referenced value that will be generated when a container is created.  On running pods you can check the resolved values by going to the Terminal tab and echoing the environment variable."></span>
          <span ng-repeat="(key, value) in env.valueFrom">
            <span ng-switch on="key">
              <span ng-switch-when="configMapKeyRef">
                Set to the key <b>{{value.key}}</b> in config map <b>{{value.name}}</b>.
              </span>
              <span ng-switch-when="secretKeyRef">
                Set to the key <b>{{value.key}}</b> in secret <b>{{value.name}}</b>.
              </span>
              <span ng-switch-when="fieldRef">
                Set to the field <b>{{value.fieldPath}}</b> in the current object.
              </span>
              <span ng-switch-default>
                Set to a reference on a <b>{{key}}</b>.
              </span>
            </span>
          </span>
        </td>
      </tr>
    </tbody>
  </table>
</div>
